home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
thor
/
thor_2.4
/
thor.lha
/
rexx
/
Event2Msg.thor
< prev
next >
Wrap
Text File
|
1996-11-11
|
4KB
|
149 lines
/*
$VER: Event2Msg.thor 1.1 (24.6.96)
by Remco van Hooff (rvhooff@globalxs.nl)
Moves the current event to any conference (on the same system).
Handy if you're writing scripts for Thor and you need a msg that contains
a sertain text, but you can't find it in your database. So now you can
write your own msg (event) and use this script to move it to your desired
conference. It can also handle an attached file.
After the event is moved the entered msg will be shown in the destination
conference.
HISTORY
1.1 - Now works correcly with systems and conferences that contain spaces.
- Fixed a problem with the Thor ARexx port.
*/
EDF_DELETED = '00000001'x /* Event is deleted */
EDF_DONE = '00000004'x /* Event is done */
EDF_ERROR = '00000008'x /* Error performing this event */
EDF_FREEZE = '00000020'x /* Event is frozen. */
options results
OPTIONS FAILAT 31
p=' '||ADDRESS()||' '||SHOW('P',,)
IF POS(' THOR.',p)>0 THEN thorport=WORD(SUBSTR(p,POS(' THOR.',p)+1),1)
ELSE DO
SAY 'THOR port not found!'
EXIT 10
END
IF ~SHOW('p', 'BBSREAD') THEN DO
ADDRESS COMMAND
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
END
ADDRESS(thorport)
GETSELECTEDEVENT
IF RC = 5 THEN DO
REQUESTNOTIFY TEXT '"The events window is not open."' BT '"_Ok"'
EXIT
END
IF RC = 30 THEN DO
REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
EXIT
END
event = RESULT
CURRENTSYSTEM STEM CURRENT
IF(RC ~= 0) THEN DO
REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT "_Ok"
EXIT
END
system = CURRENT.BBSNAME
ADDRESS BBSREAD
GETBBSDATA BBSNAME '"'system'"' STEM BBSDATA
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT "_Ok"
EXIT
END
GETCONFLIST '"'system'"' STEM CONFLIST
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT "_Ok"
EXIT
END
CALL ask_conf
ADDRESS BBSREAD
READBREVENT BBSNAME '"'system'"' EVENTNR event DATASTEM EVENTDATA TAGSSTEM EVENTTAGS
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT "_Ok"
EXIT
END
IF BITAND(EVENTDATA.FLAGS, BITOR(BITOR(BITOR(EDF_DELETED, EDF_DONE), EDF_ERROR), EDF_FREEZE)) = '00000000'x THEN CALL move
ADDRESS(thorport)
UPDATECONFWINDOW
SHOWCONFERENCE '"'conf'"'
EXIT
ask_conf:
ADDRESS(thorport)
IF CONFLIST.COUNT > 0 THEN DO
REQUESTLIST CONFLIST TITLE '"Move current event to:"' SIZEGADGET
IF (RC = 30) THEN DO
REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
EXIT
END
IF RC = 5 then EXIT
END
IF found.COUNT = 0 THEN DO
REQUESTNOTIFY '"No conferences found on system/n'system'"' '"_Ok"'
EXIT
END
conf = RESULT
RETURN
move:
MSG.FROMNAME = 'TEST MESSAGE'
MSG.FROMADDR = BBSDATA.EMAILADDR
MSG.TOADDR = EVENTTAGS.TOADDR
MSG.SUBJECT = EVENTTAGS.SUBJECT
IF EVENTTAGS.TONAME ~= 'EVENTTAGS.TONAME' THEN MSG.TONAME = EVENTTAGS.TONAME
IF ~OPEN(tmp, BBSDATA.BBSPATH||EVENTTAGS.MSGFILE, 'R') THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT "'Can not open' BBSDATA.BBSPATH||EVENTTAGS.MSGFILE" BT "_Ok"
EXIT
END
ELSE DO
z = 0
DO UNTIL EOF(tmp)
z = z+1
MSG.TEXT.z = READLN(tmp)
END
CLOSE(tmp)
MSG.TEXT.COUNT = z
IF ~(EVENTTAGS.LOCALFILE = '' | EVENTTAGS.LOCALFILE = 'EVENTTAGS.LOCALFILE') THEN DO
MSG.PART.COUNT = 1
MSG.PART.1.BINARY = EVENTTAGS.LOCALFILE
MSG.PART.1.BINARY.DESC = 'Attached file'
END
END
WRITEBRMESSAGE BBSNAME '"'system'"' confname '"'conf'"' stem MSG
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT "_Ok"
EXIT
END
UPDATEBREVENT BBSNAME '"'system'"' EVENTNR event SETDELETED
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT "_Ok"
EXIT
END
RETURN